package com.mall.shopping.converter;

import com.mall.shopping.dal.entitys.Item;
import com.mall.shopping.dto.TestProductDetailDto;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

/*这个就完成转换器和Spring的整合*/
@Mapper(componentModel = "spring")
public interface TestProductDetailConverter {

    @Mappings({
            @Mapping(source = "title", target = "name"),
            @Mapping(source = "image", target = "imgUrl")
    })
    TestProductDetailDto testProductToProductDto(Item item);
    /*Item item被转换的对象，名字是否相同，直接做转换
           tiem -----转为----->TestProductDetailDto  属性
    * @Mapping(source = "title", target = "name"),*/

}
